$(function() {
	layui.use(['element', 'layer', 'form', 'layedit', 'laydate','table'], function() {
		var element = layui.element //导航的hover效果、二级菜单等功能，需要依赖element模块
			,
			layer = layui.layer,
			layedit = layui.layedit,
			table = layui.table,
			laydate = layui.laydate,
			form = layui.form
		//监听导航点击
		element.on('nav(slide)', function(elem) {
			console.log(elem.attr("href"))
			layer.msg(elem.text());
		});
		//侧边栏伸缩
		$("#shensuo").click(function () {
			if ($("#side_nav").hasClass("close_side")){
				$("#side_nav").removeClass("close_side")
				$(".huanying_tit").removeClass("close_header")
				$(".layui-body").removeClass("close_body");
			}else{
				$("#side_nav").addClass("close_side");
				$(".huanying_tit").addClass("close_header");
				$(".layui-body").addClass("close_body");
			}
			resizeTable(350)
		})
	});
	//顶部时间显示
	var today = new Date();
	//获取当前年
	var year = today.getFullYear();
	//获取当前月
	var month = today.getMonth() + 1;
	//获取当前日
	var date = today.getDate();
	var a = new Array("日", "一", "二", "三", "四", "五", "六");
	var week = today.getDay();
	var str = "星期"+ a[week];
	$(".today_head").text("今天是"+year+"年"+month+"月"+date+"号 "+str);

})
function resizeTable(delay) {
	var that = this, runResizeTable = function(){
		$('.layui-table-view').each(function(){
			var tableID = $(this).attr('lay-id');
			layui.table.resize(tableID);
		});
	};
	if(!layui.table) return;
	delay ? setTimeout(runResizeTable, delay) : runResizeTable();
}
